package dyyx.zb;

import org.apache.flink.api.common.operators.Order;
import org.apache.flink.api.java.DataSet;
import org.apache.flink.api.java.ExecutionEnvironment;
import org.apache.flink.api.java.tuple.Tuple5;

public class SortPartitionTest {

	public static void main(String[] args) throws Exception {
		
		final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
		System.out.println("parallelism="+env.getParallelism());	
		String file = "file:/Users/dugang/work/demos/flinkdemo/docs/data/events.txt";
		DataSet<Tuple5<String,String,String,String, Double>> csvInput = env.readCsvFile(file)
               .types(String.class,String.class,String.class,String.class, Double.class);
		
		
		csvInput
		.sortPartition(2, Order.ASCENDING).setParallelism(1)
		// .sortPartition(1, Order.ASCENDING).setParallelism(1)
		.sortPartition(1, Order.DESCENDING).setParallelism(1)
		.print();
		
       
 
		// csvInput.print();

	}
	
	

}
